package com.borened.common.core.base.result;

/**
 * 业务状态码
 * <p>
 * 区分HTTP状态码，进行一些全局的错误消息定制,
 * 业务上的报错，请自行定义消息，不要放在通用枚举中。
 * </p>
 *
 * @author: cch
 * @since: 2021/12/27
 */
public enum ResultCode {
    OK(0, "OK!"),

    USER_NOT_LOGIN(10001, "身份验证失败！请登录"),
    USER_NOT_FOUND(10002, "用户不存在！"),
    USER_PASSWORD_ERROR(10003, "用户名密码错误！"),
    USER_ACCOUNT_EXCEPTION(10004, "账户暂时无法登录，请联系管理员！"),
    USER_AUTH_ERROR(10005, "内部认证错误！"),
    USER_LACK_ROLE(10006, "用户缺少角色！请联系管理员！"),
    USER_LACK_AUTHORIZE_APP(10007, "用户未经授权使用系统！请联系管理员！"),
    USER_MODIFY_PASSWORD_ERROR(10008, "修改密码发生错误！"),
    USER_AUTHORIZE_EXPIRED(10009,"用户授权已到期！"),
    USER_PERMS_LACK(10010, "用户缺少访问权限！"),

    DEMO_ACCOUNT_FORBIDDEN_OPERARTE(10011, "演示账号不允许操作！"),

    TOKEN_EXPIRED(10051, "身份过期！请重新登录"),
    INVALID_AUTHORIZE_CODE(10052, "授权码无效！"),
    CLIENT_UNAUTHORIZE(10081, "未知的客户端！请先授权"),


    SYSTEM_BUSYNESS(10101, "系统繁忙，请稍后再试！"),
    SYSTEM_ERROR(10102, "系统错误,请稍后再试！"),
    SYSTEM_CONFIG_ERROR(10103, "系统配置错误！"),
    OPERATION_FAILED(10111, "操作失败!"),

    REQ_RATE_LIMIT(10112, "请求频率太快，请稍后再试！"),

    GATEWAY_ERROR(10200, "网关内部错误！"),
    SERVICE_UNAVAILABLE(10201, "服务暂时不可用！"),
    SERVICE_CALL_ERROR(10202, "服务调用发生错误！"),

    REQUEST_PARAM_ERROR(10203, "请求参数错误！"),
    RESOURCE_NOT_FOUND(10204, "请求资源不存在！"),

    SERVICE_FLOW_LIMIT(10205, "服务流量控制！"),
    SERVICE_FALLBACK(10206, "服务熔断降级处理！"),
    SERVICE_CALL_TIMEOUT(10207, "服务调用超时！"),

    CLIENT_REDIRECT(10302, "NEED REDIRECT！"),

    //业务错误码
    CLIENT_MUST_UNIQUE(10500, "客户端ID必须唯一！"),

    //文件类型错误码
    FILE_TYPE_NOT_SUPPORT(10700, "文件类型不支持！"),
    FILE_SOURCE_ILLEGAL(10701, "文件来源非法！"),
    FILE_NAME_LENGTH_LIMIT(10702, "文件名超出最大长度！"),
    FILE_SIZE_LIMIT(10703, "文件内容超出大小！"),

    IMAGE_UPLOAD_EXCEPTION(10711, "上传图片异常"),

    ;


    /**
     * 业务响应码
     */
    private int code;
    /**
     * 响应消息
     */
    private String msg;

    ResultCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
